/*
 * ========================================================
 * Copyright(c) 2014 杭州偶尔科技-版权所有
 * ========================================================
 * 本软件由杭州偶尔科技所有, 未经书面许可, 任何单位和个人不得以
 * 任何形式复制代码的部分或全部, 并以任何形式传播。
 * 公司网址
 * 
 * 			http://www.kkkd.com/
 * 
 * ========================================================
 */
package com.simon.mengkou.future.impl;

import android.content.Context;

import com.google.gson.reflect.TypeToken;
import com.ouertech.android.agm.lib.base.constant.CstScheme;
import com.ouertech.android.agm.lib.base.future.core.AgnettyFuture;
import com.ouertech.android.agm.lib.base.future.upload.form.FormUploadFile;
import com.ouertech.android.agm.lib.base.utils.UtilList;
import com.simon.mengkou.data.bean.base.Address;
import com.simon.mengkou.data.bean.base.Banner;
import com.simon.mengkou.data.bean.base.Brand;
import com.simon.mengkou.data.bean.base.Category;
import com.simon.mengkou.data.bean.base.Comment;
import com.simon.mengkou.data.bean.base.Discovery;
import com.simon.mengkou.data.bean.base.Follow;
import com.simon.mengkou.data.bean.base.GoodTopic;
import com.simon.mengkou.data.bean.base.GroupBuy;
import com.simon.mengkou.data.bean.base.Image;
import com.simon.mengkou.data.bean.base.Invitation;
import com.simon.mengkou.data.bean.base.MessageComment;
import com.simon.mengkou.data.bean.base.MessageLike;
import com.simon.mengkou.data.bean.base.MessageNotice;
import com.simon.mengkou.data.bean.base.NewOrder;
import com.simon.mengkou.data.bean.base.Niudan;
import com.simon.mengkou.data.bean.base.NiudanAccount;
import com.simon.mengkou.data.bean.base.NiudanSKU;
import com.simon.mengkou.data.bean.base.Order;
import com.simon.mengkou.data.bean.base.Product;
import com.simon.mengkou.data.bean.base.Shop;
import com.simon.mengkou.data.bean.base.SignResult;
import com.simon.mengkou.data.bean.base.SignTime;
import com.simon.mengkou.data.bean.base.Store;
import com.simon.mengkou.data.bean.base.Tag;
import com.simon.mengkou.data.bean.base.Topic;
import com.simon.mengkou.data.bean.base.UpdateInfo;
import com.simon.mengkou.data.bean.base.User;
import com.simon.mengkou.data.bean.base.WishProduct;
import com.simon.mengkou.data.bean.req.AddCartReq;
import com.simon.mengkou.data.bean.req.AddCommentReq;
import com.simon.mengkou.data.bean.req.AddWishReq;
import com.simon.mengkou.data.bean.req.AddressReq;
import com.simon.mengkou.data.bean.req.BalanceReq;
import com.simon.mengkou.data.bean.req.CheckUpgradeReq;
import com.simon.mengkou.data.bean.req.CompartmentReq;
import com.simon.mengkou.data.bean.req.EditCartReq;
import com.simon.mengkou.data.bean.req.FeedbackReq;
import com.simon.mengkou.data.bean.req.FollowReq;
import com.simon.mengkou.data.bean.req.ForgetPwdReq;
import com.simon.mengkou.data.bean.req.GroupBuyCancelReq;
import com.simon.mengkou.data.bean.req.GroupBuyReq;
import com.simon.mengkou.data.bean.req.IdReq;
import com.simon.mengkou.data.bean.req.ImageTagReq;
import com.simon.mengkou.data.bean.req.InvitationReq;
import com.simon.mengkou.data.bean.req.JoinGroupBuyReq;
import com.simon.mengkou.data.bean.req.LoginReq;
import com.simon.mengkou.data.bean.req.ModifyPwdReq;
import com.simon.mengkou.data.bean.req.NiudanMineListReq;
import com.simon.mengkou.data.bean.req.NiudanSendReq;
import com.simon.mengkou.data.bean.req.Page2Req;
import com.simon.mengkou.data.bean.req.Page3Req;
import com.simon.mengkou.data.bean.req.Page4Req;
import com.simon.mengkou.data.bean.req.PageReq;
import com.simon.mengkou.data.bean.req.PayReq;
import com.simon.mengkou.data.bean.req.PostReadReq;
import com.simon.mengkou.data.bean.req.ProductListReq;
import com.simon.mengkou.data.bean.req.RegisterReq;
import com.simon.mengkou.data.bean.req.ShareOrderAddReq;
import com.simon.mengkou.data.bean.req.ShareOrderLikeReq;
import com.simon.mengkou.data.bean.req.SmsCodeReq;
import com.simon.mengkou.data.bean.req.SubmitOrderReq;
import com.simon.mengkou.data.bean.req.TagSearchReq;
import com.simon.mengkou.data.bean.req.UidReq;
import com.simon.mengkou.data.bean.req.UploadImagesReq;
import com.simon.mengkou.data.bean.req.UserModifyReq;
import com.simon.mengkou.data.bean.req.VerifySmsCodeReq;
import com.simon.mengkou.data.enums.EFileBelong;
import com.simon.mengkou.data.enums.ESmsType;
import com.simon.mengkou.future.base.OuerFutureListener;
import com.simon.mengkou.future.base.defaults.OuerFormUploadDefaultHandler;
import com.simon.mengkou.future.base.defaults.OuerHttpDefaultHandler;
import com.simon.mengkou.future.base.defaults.OuerLocalDefaultHandler;
import com.simon.mengkou.future.handler.AddCartHandler;
import com.simon.mengkou.future.handler.AddressListHandler;
import com.simon.mengkou.future.handler.CartProductNumHandler;
import com.simon.mengkou.future.handler.DeleteCartHandler;
import com.simon.mengkou.future.handler.ClearCacheHandler;
import com.simon.mengkou.future.handler.DeleteAddressHandler;
import com.simon.mengkou.future.handler.EditAddressHandler;
import com.simon.mengkou.future.handler.ExitLoginHandler;
import com.simon.mengkou.future.handler.LoginHandler;
import com.simon.mengkou.future.handler.OrderCancelHandler;
import com.simon.mengkou.future.handler.OrderConfirmHandler;
import com.simon.mengkou.future.handler.OrderSubmitHandler;
import com.simon.mengkou.future.handler.ShareOrderAddHandler;
import com.simon.mengkou.future.handler.ShareOrderLikeHandler;
import com.simon.mengkou.future.handler.SplashHandler;
import com.simon.mengkou.future.handler.UserModifyHandler;
import com.simon.mengkou.future.handler.WishListHandler;
import com.simon.mengkou.system.constant.CstOuer;
import com.simon.mengkou.system.global.OuerApplication;

import java.util.List;

/**
 * @author : Zhenshui.Xia
 * @date : 2015/9/15.
 * @desc : 任务实现类,目前任务接口主要可以分为：本地任务、http任务、下载任务、上传任务、主线程任务
 */
public class OuerFuture extends AbsOuerFuture {
    //接口地址--------------------------
    //检查升级接口地址
    private static final String CHECK_UPGRADE           = CstOuer.API_URL +  "/software/version/check";
    //扭蛋列表接口地址
    private static final String NIUDAN_LIST             = CstOuer.API_URL +  "/niudan/list";
    //扭蛋详情接口地址
    private static final String NIUDAN_DETAIL           = CstOuer.API_URL +  "/niudan/detail";
    //获取我的扭券、扭扣等信息
    private static final String NIUDAN_ACCOUNT          = CstOuer.API_URL +  "/niudan/myAccount";
    //获取我的扭蛋图鉴
    private static final String NIUDAN_MINE_LIST        = CstOuer.API_URL +  "/niudan/mine/list";
    //查询扭蛋资格
    private static final String NIUDAN_CHECK            = CstOuer.API_URL +  "/niudan/check";
    //开始扭蛋
    private static final String NIUDAN_START            = CstOuer.API_URL +  "/niudan/start";
    //开始寄送
    private static final String NIUDAN_SEND             = CstOuer.API_URL +  "/niudan/send";





    //获取注册短信验证码
    private static final String GET_REGISTER_CODE       = CstOuer.API_URL +  "/register/send-sms-code";
    //忘记密码后重设密码获取手机验证码
    private static final String GET_FORGET_CODE         = CstOuer.API_URL +  "/forget-pwd-sms-code";
    // 注册(手机号码和验证码)的校验接口
    public static final String VERIFY_REGISTER_CODE     = CstOuer.API_URL +  "/register/verify";
    // 找回密码(手机号码和验证码)的校验接口
    public static final String VERIFY_FORGET_CODE       = CstOuer.API_URL +  "/forget-pwd-verify";
    //注册
    private static final String REGISTER                = CstOuer.API_URL +  "/register/create";
    //忘记密码后重设密码
    private static final String FORGET_PWD              = CstOuer.API_URL +  "/forget-pwd-reset";
    // 修改密码
    public static final String MODIFY_PWD               = CstOuer.API_URL +  "/user/change-pwd";
    //用户登录
    private static final String LOGIN                   = CstOuer.API_URL +  "/login";
    //图片上传
    private static final String UPLOAD_IMAGES                   = CstOuer.API_URL +  "/_f/u";
    //用户信息修改
    private static final String MODIFY_USER                   = CstOuer.API_URL +  "/user/modify";


    //用户反馈接口地址
    private static final String FEEDBACK                = CstOuer.API_URL + "/user/software/feedback";


    //获取消息通知列表
    private static final String MESSAGE_NOTICE          = CstOuer.API_URL + "/message/notice/list";
    //获取消息赞
    private static final String MESSAGE_LIKE            = CstOuer.API_URL + "/message/faver/list";
    //获取消息评论
    private static final String MESSAGE_COMMENT         = CstOuer.API_URL + "/message/comment/list";
    //获取消息新粉丝
    private static final String MESSAGE_FANS            = CstOuer.API_URL + "/message/new-friend";

    //获取粉丝列表
    private static final String FANS_LIST               = CstOuer.API_URL + "/user/fans/list";
    //获取关注列表
    private static final String FOLLOW_LIST             = CstOuer.API_URL + "/user/follow/list";
    //关注or取消关注
    private static final String FOLLOW                  = CstOuer.API_URL + "/user/interest";
    //用户信息
    private static final String USER_INFO               = CstOuer.API_URL + "/user/detail";

    //晒单接口地址
    private static final String HOME_FOLLOW             = CstOuer.API_URL + "/home/follow/list";
    //话题接口地址
    private static final String HOME_TOPIC              = CstOuer.API_URL + "/home/topic/list";
    //最新接口地址
    private static final String HOME_NEW                = CstOuer.API_URL + "/home/new/list";
    //发现接口地址
    private static final String DISCOVERY               = CstOuer.API_URL + "/finding/list";

    //获取收货地址列表
    private static final String ADDRESS_LIST               = CstOuer.API_URL + "/address/list";
    //保存、编辑收货地址
    private static final String EDIT_ADDRESS               = CstOuer.API_URL + "/address/edit";
    //删除收货地址
    private static final String DELETE_ADDRESS               = CstOuer.API_URL + "/address/delete";
    //设置默认收货地址
    private static final String DEFAULT_ADDRESS               = CstOuer.API_URL + "/address/default/set";

    //购买分类
    private static final String BUY_CATEGORY               = CstOuer.API_URL + "/category/list";
    //购买分类数据
    private static final String BUY_GOODS_LIST               = CstOuer.API_URL + "/goods/list";


    //话题详情接口地址
    private static final String TOPIC_DETAIL               = CstOuer.API_URL + "/topic/detail";

    //商品详情接口地址
    private static final String PRODUCT_DETAIL               = CstOuer.API_URL + "/goods/detail";
    //商品-相关晒单
    private static final String PRODUCT_SHARE_ORDER               = CstOuer.API_URL + "/goods/shareorder/list";

    //我的订单
    private static final String MY_ORDERS               = CstOuer.API_URL + "/user/orders";
    //订单详情
    private static final String ORDER_DETAIL               = CstOuer.API_URL + "/order/detail";
    //提交订单
    private static final String ORDER_SUBMIT               = CstOuer.API_URL + "/order/submit";
    //预提交订单
    private static final String PREORDER_SUBMIT               = CstOuer.API_URL + "/order/presubmit";
    //提交付款
    private static final String ORDER_PAY               = CstOuer.API_URL + "/order/pay";

    //取消订单
    private static final String CANCEL_ORDER               = CstOuer.API_URL + "/order/cancel";
    //确认收货
    private static final String CONFIRM_ORDER               = CstOuer.API_URL + "/order/received/confirm";
    //查看物流信息
    private static final String EXPRESS_INFO               = CstOuer.API_URL + "/order/express";

    //我的购物车
    private static final String CART_LIST               = CstOuer.API_URL + "/cart/list";
    //添加到购物车
    private static final String CART_ADD               = CstOuer.API_URL + "/cart/add";
    //编辑购物车
    private static final String CART_EDIT              = CstOuer.API_URL + "/cart/edit";


    //我的团购
    private static final String USER_GROUPBUY               = CstOuer.API_URL + "/user/groupbuy";
    //参加拼团或预售
    private static final String JOIN_GROUPBUY               = CstOuer.API_URL + "/groupbuy/join";
    //取消拼团
    private static final String CANCEL_GROUPBUY               = CstOuer.API_URL + "/groupbuy/cancel";
    //我的优惠券
    private static final String USER_COUPONS               = CstOuer.API_URL + "/user/coupons";

    //晒单详情
    private static final String SHARE_ORDER_DETAIL               = CstOuer.API_URL + "/shareorder/detail";
    //晒单评论
    private static final String SHARE_ORDER_COMMENTS               = CstOuer.API_URL + "/shareorder/comment/list";
    //晒单-添加评论
    private static final String SHARE_ORDER_ADDCOMMENT               = CstOuer.API_URL + "/shareorder/addcomment";

    //晒单点赞
    private static final String SHARE_ORDER_LIKE               = CstOuer.API_URL + "/shareorder/addfaver";

    //品牌详情
    private static final String BRAND_DETAIL               = CstOuer.API_URL + "/brand/detail";

    //用户的晒单
    private static final String USER_SHARE_ORDER               = CstOuer.API_URL + "/user/shareorder/list";
    //用户的话题
    private static final String USER_TOPIC               = CstOuer.API_URL + "/user/topic/list";
    //用户的视频
    private static final String USER_VIDEO               = CstOuer.API_URL + "/user/collect/video";

    //发布晒单
    private static final String SHARE_ORDER_ADD               = CstOuer.API_URL + "/shareorder/add";
    //晒单标签列表
    private static final String SHARE_ORDER_TAG_SEARCH     = CstOuer.API_URL + "/shareorder/tags/list";

    //话题关注
    private static final String TOPIC_FOLLOW     = CstOuer.API_URL + "/topic/addfollow";

    //用户是否被邀请
    private static final String IS_INVITATION     = CstOuer.API_URL + "/user/isInvitation";

    //标签的帖子聚合
    private static final String TAG_POSTS       = CstOuer.API_URL + "/tag/posts";

    //专题评论点赞
    private static final String TOPIC_COMMENT_FAVER       = CstOuer.API_URL + "/topic/comment/faver";
    //专题点赞
    private static final String TOPIC_FAVER       = CstOuer.API_URL + "/topic/faver";
    //专题评论列表
    private static final String TOPIC_COMMENT_LIST       = CstOuer.API_URL + "/topic/comment/list";
    //专题评论
    private static final String TOPIC_ADDCOMMENT       = CstOuer.API_URL + "/topic/addcomment";

    //今日推荐
    private static final String GOODS_RECOMMEND     = CstOuer.API_URL + "/goods/recommend";


    //首页Banner列表
    private static final String HOME_BANNER_LIST     = CstOuer.API_URL + "/home/banner/list";
    //首页商品专题
    private static final String HOME_GOODS_TOPIC_LIST     = CstOuer.API_URL + "/home/goods/topic/list";
    private static final String HOME_NEWHOT_GOODS_TOPIC     = CstOuer.API_URL + "/home/newhot/goods/topic";
    //热门帖子
    private static final String HOME_HOT_POST_LIST     = CstOuer.API_URL + "/home/hot/post/list";
    //热门帖子
    private static final String NEW_HOT_POST_LIST     = CstOuer.API_URL + "/new/top/post/list";
    //置顶视频列表(视频帖子)
    private static final String TOP_VIDEO_LIST     = CstOuer.API_URL + "/top/video/list";
    //所有视频列表(视频帖子)
    private static final String HOME_VIDEO_LIST     = CstOuer.API_URL + "/home/video/list";
    //商品专题列表
    private static final String GOODS_TOPIC_LIST     = CstOuer.API_URL + "/goods/topic/list";

    //用户是否已签到
    private static final String USER_ISSIGN     = CstOuer.API_URL + "/user/isSign";
    //签到
    private static final String USER_SIGN     = CstOuer.API_URL + "/user/sign";
    //用户签到列表
    private static final String USER_SIGN_LIST     = CstOuer.API_URL + "/user/signlist";

    //帖子阅读
    private static final String POST_READ     = CstOuer.API_URL + "/post/read";
    //视频收藏
    private static final String VIDEO_FOLLOW     = CstOuer.API_URL + "/video/collect";
    //视频播放
    private static final String VIDEO_PLAY     = CstOuer.API_URL + "/video/play";

    //专题对应商品
    private static final String TOPIC_RELATIVE_GOODS     = CstOuer.API_URL + "/topic/relative/goods";
    //置顶的专题
    private static final String TOP_TOPIC_LIST     = CstOuer.API_URL + "/top/topic/list";
    //商品专题详情
    private static final String GOODS_TOPIC_DETAIL     = CstOuer.API_URL + "/goods/topic/detail";

    //商品专题详情
    private static final String PHONE_VALIDATE     = CstOuer.API_URL + "/phone/validate";

    //图片标签搜索
    private static final String IMAGE_TAGS     = CstOuer.API_URL + "/image/tags";

    //心愿单列表
    private static final String WISH_LIST     = CstOuer.API_URL + "/user/goods/collect/list";
    //加入心愿单
    private static final String ADD_WISH     = CstOuer.API_URL + "/goods/collect/add";
    //商品分仓列表
    private static final String PRODUCT_COMPARTMENT_LIST     = CstOuer.API_URL + "/store/goods/list";
    //热销榜单
    private static final String HOT_SALES     = CstOuer.API_URL + "/home/hotsell";
    //购物车商品数量
    private static final String CART_PRODUCT_NUM     = CstOuer.API_URL + "/cart/goods/count";
    //购物车商品列表
    private static final String NEW_CART_LIST     = CstOuer.API_URL + "/cart/goods/list";
    //购物车结算
    private static final String CART_BALANCE     = CstOuer.API_URL + "/cart/balance";



    public OuerFuture(Context context, String project, boolean debug, boolean cookie) {
        super(context, project, debug, cookie);
    }

    //任务实现--------------------------
    /**
     * 检查升级
     * @param version   版本号（对应android version code）
     * @param osType    系统类型（ANDROID/IOS)
     * @param channel   渠道号
     * @param listener
     * @return
     */
    public AgnettyFuture checkUpgrade(int version,
               String osType, String channel, OuerFutureListener listener) {
        CheckUpgradeReq req = new CheckUpgradeReq();
        req.setClientVersion(version);
        req.setOsType(osType);
        req.setChannel(channel);

        return execHttpPostFuture(CHECK_UPGRADE,
                OuerHttpDefaultHandler.class,
                CHECK_UPGRADE,
                req,
                new TypeToken<UpdateInfo>() {}.getType(),
                listener);
    }


    /**
     * 获取扭蛋列表数据
     * @param page
     * @param size
     * @param listener
     * @return
     */
    public AgnettyFuture getNiudanList(int page, int size, OuerFutureListener listener) {
        PageReq req = new PageReq();
        req.setPage(page);
        req.setSize(size);

        return execHttpPostFuture(NIUDAN_LIST,
                OuerHttpDefaultHandler.class,
                NIUDAN_LIST,
                req,
                new TypeToken<List<Niudan>>() {}.getType(),
                listener);
    }


    /**
     * 获取扭蛋详情数据
     * @param id
     * @param listener
     * @return
     */
    public AgnettyFuture getNiudanDetail(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(NIUDAN_DETAIL,
                OuerHttpDefaultHandler.class,
                NIUDAN_DETAIL,
                req,
                new TypeToken<Niudan>() {}.getType(),
                listener);
    }


    /**
     * 获取我的扭券、扭扣等信息
     * @param uid
     * @param listener
     * @return
     */
    public AgnettyFuture getNiudanAccount(String uid, OuerFutureListener listener) {
        UidReq req = new UidReq();
        req.setUid(uid);

        return execHttpPostFuture(NIUDAN_ACCOUNT,
                OuerHttpDefaultHandler.class,
                NIUDAN_ACCOUNT,
                req,
                new TypeToken<NiudanAccount>() {}.getType(),
                listener);

    }



    /**
     * 获取我的扭蛋图鉴
     * @param uid
     * @param page
     * @param size
     * @param listener
     * @return
     */
    public AgnettyFuture getNiudanMineList(String uid, int page, int size, OuerFutureListener listener) {
        NiudanMineListReq req = new NiudanMineListReq();
        req.setUid(uid);
        req.setPage(page);
        req.setSize(size);

        return execHttpPostFuture(NIUDAN_MINE_LIST,
                OuerHttpDefaultHandler.class,
                NIUDAN_MINE_LIST,
                req,
                new TypeToken<List<Niudan>>() {}.getType(),
                listener);


    }


    /**
     * 查询扭蛋资格
     * @param id
     * @param listener
     * @return
     */
    public AgnettyFuture niudanCheck(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(NIUDAN_CHECK,
                OuerHttpDefaultHandler.class,
                NIUDAN_CHECK,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 开始扭蛋
     * @param id
     * @param listener
     * @return
     */
    public AgnettyFuture niudanStart(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(NIUDAN_START,
                OuerHttpDefaultHandler.class,
                NIUDAN_START,
                req,
                new TypeToken<NiudanSKU>() {}.getType(),
                listener);
    }


    /**
     * 扭蛋寄送
     * @param listener
     * @return
     */
    public AgnettyFuture niudanSend(String uid, List<Niudan> niudans, OuerFutureListener listener) {
        NiudanSendReq req = new NiudanSendReq();
        req.setUid(uid);
        req.setData(niudans);

        return execHttpPostFuture(NIUDAN_SEND,
                OuerHttpDefaultHandler.class,
                NIUDAN_SEND,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }


    /**
     * 闪屏延时
     * @param delay
     * @param listener
     * @return
     */
    public AgnettyFuture delaySplash(int delay, OuerFutureListener listener) {
        return execLocalFuture(delay, SplashHandler.class, listener);
    }


    /**
     * 普通延时
     */
    public AgnettyFuture delay(int delay, OuerFutureListener listener) {
        return execLocalFuture(delay, OuerLocalDefaultHandler.class, listener);
    }

    /**
     * 定时
     */
    public AgnettyFuture schedule(int startTime, int intervalTime, int maxTime, OuerFutureListener listener) {
        return execLocalScheduleFuture(startTime, intervalTime, maxTime, OuerLocalDefaultHandler.class, listener);
    }

    /**
     * 清除缓存
     */
    public AgnettyFuture clearCache(OuerFutureListener listener) {
        return execLocalFuture(0, ClearCacheHandler.class, listener);
    }

    /**
     * 清除缓存
     */
    public AgnettyFuture deleteCart(List<Product> products, OuerFutureListener listener) {
        return execLocalFuture(0, products, DeleteCartHandler.class, listener);
    }

    /**
     * 退出登录
     * @param listener
     * @return
     */
    public AgnettyFuture exitLogin(OuerFutureListener listener) {
        return execLocalFuture(0, ExitLoginHandler.class, listener);
    }


    /**
     * 用户反馈
     */
    public AgnettyFuture feedback(String content, String contact,
                                  OuerFutureListener listener) {
        FeedbackReq req = new FeedbackReq();
        req.setContent(content);
        req.setContact(contact);

        return execHttpPostFuture(FEEDBACK,
                OuerHttpDefaultHandler.class,
                FEEDBACK,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 登录接口
     */
    public AgnettyFuture login(LoginReq req, OuerFutureListener listener) {
        return execHttpPostFuture(LOGIN,
                LoginHandler.class,
                LOGIN,
                req,
                new TypeToken<User>() {}.getType(),
                listener);
    }


    /**
     * 获取短信验证码接口
     */
    public AgnettyFuture getSmsCode(String phone, int type,
                                    OuerFutureListener listener) {
        SmsCodeReq req = new SmsCodeReq();
        req.setPhone(phone);

        if (type == ESmsType.SMS_TYPE_REGISTER) {
            return execHttpPostFuture(GET_REGISTER_CODE,
                    OuerHttpDefaultHandler.class,
                    GET_REGISTER_CODE,
                    req,
                    new TypeToken<Boolean>() {}.getType(),
                    listener);
        } else {
            return execHttpPostFuture(GET_FORGET_CODE,
                    OuerHttpDefaultHandler.class,
                    GET_FORGET_CODE,
                    req,
                    new TypeToken<Boolean>() {}.getType(),
                    listener);
        }
    }

    /**
     * 验证短信验证码接口
     *
     * @param phone
     * @param code
     * @param type
     * @param listener
     * @return
     */
	public AgnettyFuture verifySmsCode(String phone, String code,
			int type, OuerFutureListener listener) {
        VerifySmsCodeReq req = new VerifySmsCodeReq();
        req.setPhone(phone);
        req.setCode(code);

        if (type == ESmsType.SMS_TYPE_REGISTER) {
            return execHttpPostFuture(VERIFY_REGISTER_CODE,
                    OuerHttpDefaultHandler.class,
                    VERIFY_REGISTER_CODE,
                    req,
                    new TypeToken<Boolean>() {}.getType(),
                    listener);
        } else {
            return execHttpPostFuture(VERIFY_FORGET_CODE,
                    OuerHttpDefaultHandler.class,
                    VERIFY_FORGET_CODE,
                    req,
                    new TypeToken<Boolean>() {}.getType(),
                    listener);
        }
	}


    /**
     * 注册接口
     */
    public AgnettyFuture register(String phone, String passwd, String code,
                                  OuerFutureListener listener) {
        RegisterReq req = new RegisterReq();
        req.setPhone(phone);
        req.setPasswd(passwd);
        req.setCode(code);

        return execHttpPostFuture(REGISTER,
                LoginHandler.class,
                REGISTER,
                req,
                new TypeToken<User>() {}.getType(),
                listener);
    }


    /**
     * 修改密码接口
     */
    public AgnettyFuture modifyPwd(String oldPwd, String newPwd,
                                   OuerFutureListener listener) {
        ModifyPwdReq req = new ModifyPwdReq();
        req.setOldPwd(oldPwd);
        req.setNewPwd(newPwd);

        return execHttpPostFuture(MODIFY_PWD,
                OuerHttpDefaultHandler.class,
                MODIFY_PWD,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 忘记密码接口
     */
    public AgnettyFuture forgetPwd(String phone, String passwd, String code,
                                   OuerFutureListener listener) {
        ForgetPwdReq req = new ForgetPwdReq();
        req.setPhone(phone);
        req.setPasswd(passwd);
        req.setCode(code);

        return execHttpPostFuture(FORGET_PWD,
                OuerHttpDefaultHandler.class,
                FORGET_PWD,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }



    /**
     * 获取消息通知接口
     */
    public AgnettyFuture messageNotice(String uid, String maxId, String minId, int size,
                                   OuerFutureListener listener) {
        Page2Req req = new Page2Req();
        req.setUid(uid);
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);

        return execHttpPostFuture(MESSAGE_NOTICE,
                OuerHttpDefaultHandler.class,
                MESSAGE_NOTICE,
                req,
                new TypeToken<List<MessageNotice>>() {}.getType(),
                listener);
    }


    /**
     * 获取消息点赞接口
     */
    public AgnettyFuture messageLike(String uid, String maxId, String minId, int size,
                                       OuerFutureListener listener) {
        Page2Req req = new Page2Req();
        req.setUid(uid);
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);

        return execHttpPostFuture(MESSAGE_LIKE,
                OuerHttpDefaultHandler.class,
                MESSAGE_LIKE,
                req,
                new TypeToken<List<MessageLike>>() {}.getType(),
                listener);
    }

    /**
     * 获取消息评论接口
     */
    public AgnettyFuture messageComment(String uid, String maxId, String minId, int size,
                                       OuerFutureListener listener) {
        Page2Req req = new Page2Req();
        req.setUid(uid);
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);

        return execHttpPostFuture(MESSAGE_COMMENT,
                OuerHttpDefaultHandler.class,
                MESSAGE_COMMENT,
                req,
                new TypeToken<List<MessageComment>>() {}.getType(),
                listener);
    }

    /**
     * 获取消息新粉丝接口
     */
    public AgnettyFuture messageFan(String uid, String maxId, String minId, int size,
                                       OuerFutureListener listener) {
        Page2Req req = new Page2Req();
        req.setUid(uid);
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);

        return execHttpPostFuture(MESSAGE_FANS,
                OuerHttpDefaultHandler.class,
                MESSAGE_FANS,
                req,
                new TypeToken<List<User>>() {}.getType(),
                listener);
    }


    /**
     * 获取发现数据
     * @param page
     * @param size
     * @param listener
     * @return
     */
    public AgnettyFuture getDiscovery(int page, int size, OuerFutureListener listener) {
        PageReq req = new PageReq();
        req.setPage(page);
        req.setSize(size);

        return execHttpPostFuture(DISCOVERY,
                OuerHttpDefaultHandler.class,
                DISCOVERY,
                req,
                new TypeToken<List<Discovery>>() {}.getType(),
                listener);
    }

    /**
     * 获取首页晒单数据
     */
    public AgnettyFuture getHomeFollowList(String maxId, String minId, int size,
                                    OuerFutureListener listener) {
        Page2Req req = new Page2Req();
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);
        req.setVersion(OuerApplication.mAppInfo.getVersionName());


        return execHttpPostFuture(HOME_FOLLOW,
                OuerHttpDefaultHandler.class,
                HOME_FOLLOW,
                req,
                new TypeToken<List<Follow>>() {}.getType(),
                listener);
    }


    /**
     * 获取首页主题数据
     */
    public AgnettyFuture getHomeTopicList(String maxId, String minId, int size,
                                           OuerFutureListener listener) {
        Page2Req req = new Page2Req();
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);

        return execHttpPostFuture(HOME_TOPIC,
                OuerHttpDefaultHandler.class,
                HOME_TOPIC,
                req,
                new TypeToken<List<Topic>>() {}.getType(),
                listener);
    }


    /**
     * 获取首页晒单数据
     */
    public AgnettyFuture getHomeNewList(String maxId, String minId, int size,
                                           OuerFutureListener listener) {
        Page2Req req = new Page2Req();
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);

        return execHttpPostFuture(HOME_NEW,
                OuerHttpDefaultHandler.class,
                HOME_NEW,
                req,
                new TypeToken<List<Follow>>() {}.getType(),
                listener);
    }

    /**
     * 获取粉丝列表接口
     */
    public AgnettyFuture fansList(String uid, String sortId, String type, int size,
                                       OuerFutureListener listener) {
        Page4Req req = new Page4Req();
        req.setUid(uid);
        req.setSortId(sortId);
        req.setType(type);
        req.setSize(size);

        return execHttpPostFuture(FANS_LIST,
                OuerHttpDefaultHandler.class,
                FANS_LIST,
                req,
                new TypeToken<List<User>>() {}.getType(),
                listener);
    }

    /**
     * 获取关注列表接口
     */
    public AgnettyFuture followList(String uid, String sortId, String type, int size,
                                    OuerFutureListener listener) {
        Page4Req req = new Page4Req();
        req.setUid(uid);
        req.setSortId(sortId);
        req.setType(type);
        req.setSize(size);

        return execHttpPostFuture(FOLLOW_LIST,
                OuerHttpDefaultHandler.class,
                FOLLOW_LIST,
                req,
                new TypeToken<List<User>>() {}.getType(),
                listener);
    }

    /**
     * 关注or取消关注接口
     */
    public AgnettyFuture follow(String uid, String targetId, boolean checked,
                                       OuerFutureListener listener) {
        FollowReq req = new FollowReq();
        req.setUid(uid);
        req.setTargetId(targetId);
        req.setChecked(checked);

        return execHttpPostFuture(FOLLOW,
                OuerHttpDefaultHandler.class,
                FOLLOW,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }


    /**
     * 获取用户信息接口
     */
    public AgnettyFuture getUserInfo(String uid, OuerFutureListener listener) {
        UidReq req = new UidReq();
        req.setUid(uid);

        return execHttpPostFuture(USER_INFO,
                OuerHttpDefaultHandler.class,
                USER_INFO,
                req,
                new TypeToken<User>() {}.getType(),
                listener);
    }


    /**
     * 保存、编辑货地址接口
     */
    public AgnettyFuture editAddress(Address address, OuerFutureListener listener) {
        AddressReq req = new AddressReq();
        req.setId(address.getId());
        req.setConsignee(address.getName());
        req.setPhone(address.getPhone());
        req.setZone(address.getAddress());
        req.setDetailAddress(address.getDetail());

        return execHttpPostFuture(EDIT_ADDRESS,
                EditAddressHandler.class,
                EDIT_ADDRESS,
                req,
                new TypeToken<Address>() {}.getType(),
                listener);
    }

    /**
     * 删除收货地址接口
     */
    public AgnettyFuture deleteAddress(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(DELETE_ADDRESS,
                DeleteAddressHandler.class,
                DELETE_ADDRESS,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 保存默认收货地址接口
     */
    public AgnettyFuture defaultAddress(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(DEFAULT_ADDRESS,
                OuerHttpDefaultHandler.class,
                DEFAULT_ADDRESS,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 获取收货地址列表接口
     */
    public AgnettyFuture getAddressList(String uid, OuerFutureListener listener) {
        UidReq req = new UidReq();
        req.setUid(uid);

        return execHttpPostFuture(ADDRESS_LIST,
                AddressListHandler.class,
                ADDRESS_LIST,
                req,
                new TypeToken<List<Address>>() {}.getType(),
                listener);
    }

    /**
     * 获取购买分类接口
     */
    public AgnettyFuture buyCategory(OuerFutureListener listener) {

        return execHttpPostFuture(BUY_CATEGORY,
                OuerHttpDefaultHandler.class,
                BUY_CATEGORY,
                null,
                new TypeToken<List<Category>>() {}.getType(),
                listener);
    }

    /**
     * 获取购买分类数据接口
     */
    public AgnettyFuture buyGoodsList(String id, int page, int size, OuerFutureListener listener) {
    ProductListReq req = new ProductListReq();
        req.setId(id);
        req.setPage(page);
        req.setSize(size);


        return execHttpPostFuture(BUY_GOODS_LIST,
                OuerHttpDefaultHandler.class,
                BUY_GOODS_LIST,
                req,
                new TypeToken<List<Product>>() {}.getType(),
                listener);
    }


    /**
     * 获取商品详情
     */
    public AgnettyFuture getProductDetail(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(PRODUCT_DETAIL,
                OuerHttpDefaultHandler.class,
                PRODUCT_DETAIL,
                req,
                new TypeToken<Product>() {}.getType(),
                listener);
    }

    /**
     * 获取商品订单
     */
    public AgnettyFuture getProductOrders(String id, String maxId, String minId, int size,
                                          OuerFutureListener listener) {
        Page3Req req = new Page3Req();
        req.setId(id);
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);

        return execHttpPostFuture(PRODUCT_SHARE_ORDER,
                OuerHttpDefaultHandler.class,
                PRODUCT_SHARE_ORDER,
                req,
                new TypeToken<List<Follow>>() {}.getType(),
                listener);
    }

    /**
     * 获取我的订单
     */
    public AgnettyFuture getMyOrders(String maxId, String minId, int size,
                                          OuerFutureListener listener) {
        Page2Req req = new Page2Req();
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);

        return execHttpPostFuture(MY_ORDERS,
                OuerHttpDefaultHandler.class,
                MY_ORDERS,
                req,
                new TypeToken<List<Order>>() {}.getType(),
                listener);
    }


    /**
     * 获取我的订单
     */
    public AgnettyFuture orderDetail(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(ORDER_DETAIL,
                OuerHttpDefaultHandler.class,
                ORDER_DETAIL,
                req,
                new TypeToken<NewOrder>() {}.getType(),
                listener);
    }


    /**
     * 预提交订单
     */
    public AgnettyFuture presubmitOrder(String coupon, OuerFutureListener listener) {
        SubmitOrderReq req = new SubmitOrderReq();
        req.setCoupon(coupon);

        return execHttpPostFuture(PREORDER_SUBMIT,
                OuerHttpDefaultHandler.class,
                PREORDER_SUBMIT,
                req,
                new TypeToken<NewOrder>() {}.getType(),
                listener);
    }


    /**
     * 确认订单
     */
    public AgnettyFuture submitOrder(String addressId, String coupon, OuerFutureListener listener) {
        SubmitOrderReq req = new SubmitOrderReq();
        req.setAddressId(addressId);
        req.setCoupon(coupon);

        return execHttpPostFuture(ORDER_SUBMIT,
                OrderSubmitHandler.class,
                ORDER_SUBMIT,
                req,
                new TypeToken<NewOrder>() {}.getType(),
                listener);
    }

    /**
     * 订单付款
     */
    public AgnettyFuture payOrder(String id, int type, OuerFutureListener listener) {
        PayReq req = new PayReq();
        req.setId(id);
        req.setType(type);

        return execHttpPostFuture(ORDER_PAY,
                OuerHttpDefaultHandler.class,
                ORDER_PAY,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 取消订单
     */
    public AgnettyFuture cancelOrder(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(CANCEL_ORDER,
                OrderCancelHandler.class,
                CANCEL_ORDER,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 确认收货
     */
    public AgnettyFuture confirmOrder(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(CONFIRM_ORDER,
                OrderConfirmHandler.class,
                CONFIRM_ORDER,
                req,
                new TypeToken<Void>() {}.getType(),
                listener);
    }



    /**
     * 获取物流信息
     */
    public AgnettyFuture expressInfo(String id, OuerFutureListener listener) {
//        IdReq req = new IdReq();
//        req.setId(id);
//
//        return execHttpPostFuture(EXPRESS_INFO,
//                OuerHttpDefaultHandler.class,
//                EXPRESS_INFO,
//                req,
//                new TypeToken<Express>() {}.getType(),
//                listener);


        CheckUpgradeReq req = new CheckUpgradeReq();
        req.setClientVersion(1000);
        req.setOsType("ANDROID");
        req.setChannel("XIAOMI");

        return execHttpPostFuture(CHECK_UPGRADE,
                OuerHttpDefaultHandler.class,
                CHECK_UPGRADE,
                req,
                new TypeToken<UpdateInfo>() {}.getType(),
                listener);
    }


    /**
     * 获取我的购物车数据
     */
    public AgnettyFuture cartList(String id, OuerFutureListener listener) {
        UidReq req = new UidReq();
        req.setUid(id);

        return execHttpPostFuture(CART_LIST,
                OuerHttpDefaultHandler.class,
                CART_LIST,
                req,
                new TypeToken<List<Shop>>() {}.getType(),
                listener);
    }


    /**
     * 添加到购物车
     */
    public AgnettyFuture cartAdd(String id, int num, OuerFutureListener listener) {
        AddCartReq req = new AddCartReq();
        req.setGoodsId(id, num);

        return execHttpPostFuture(CART_ADD,
                AddCartHandler.class,
                CART_ADD,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 编辑购物车
     */
    public AgnettyFuture cartEdit(String id, int num, String itemId, OuerFutureListener listener) {
        EditCartReq req = new EditCartReq();
        req.setGoodsId(id, num);
        req.setOrderItemId(itemId);

        return execHttpPostFuture(CART_EDIT,
                OuerHttpDefaultHandler.class,
                CART_EDIT,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }



    /**
     * 获取优惠券接口
     */
    public AgnettyFuture userCoupons(String maxId, String minId, int size
            , OuerFutureListener listener) {
//        Page2Req req = new Page2Req();
//        req.setMaxId(maxId);
//        req.setMinId(minId);
//        req.setSize(size);
//
//        return execHttpPostFuture(USER_COUPONS,
//                OuerHttpDefaultHandler.class,
//                USER_COUPONS,
//                req,
//                new TypeToken<List<Coupon>>() {}.getType(),
//                listener);

        CheckUpgradeReq req = new CheckUpgradeReq();
        req.setClientVersion(1000);
        req.setOsType("ANDROID");
        req.setChannel("XIAOMI");

        return execHttpPostFuture(CHECK_UPGRADE,
                OuerHttpDefaultHandler.class,
                CHECK_UPGRADE,
                req,
                new TypeToken<UpdateInfo>() {}.getType(),
                listener);
    }


    /**
     * 获取团购接口
     */
    public AgnettyFuture userGroupBuy(String maxId, String minId, int size, int type,
            OuerFutureListener listener) {
        GroupBuyReq req = new GroupBuyReq();
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);
        req.setType(type);

        return execHttpPostFuture(USER_GROUPBUY,
                OuerHttpDefaultHandler.class,
                USER_GROUPBUY,
                req,
                new TypeToken<List<GroupBuy>>() {}.getType(),
                listener);
    }


    /**
     * 取消拼团接口
     */
    public AgnettyFuture joinGroupBuy(String id, int quantity,
                      int type, String addressId, OuerFutureListener listener) {
        JoinGroupBuyReq req = new JoinGroupBuyReq();
        req.setId(id);
        req.setQuantity(quantity);
        req.setType(type);
        req.setAddressId(addressId);

        return execHttpPostFuture(JOIN_GROUPBUY,
                OuerHttpDefaultHandler.class,
                JOIN_GROUPBUY,
                req,
                new TypeToken<Order>() {}.getType(),
                listener);
    }


    /**
     * 取消拼团接口
     */
    public AgnettyFuture cancelGroupBuy(String id, String orderId, OuerFutureListener listener) {
        GroupBuyCancelReq req = new GroupBuyCancelReq();
        req.setId(id);
        req.setOrderId(orderId);

        return execHttpPostFuture(CANCEL_GROUPBUY,
                OuerHttpDefaultHandler.class,
                CANCEL_GROUPBUY,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 获取晒单评论接口
     */
    public AgnettyFuture shareOrderComments(String maxId, String minId, int size, String id,
                                      OuerFutureListener listener) {
        Page3Req req = new Page3Req();
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);
        req.setId(id);

        return execHttpPostFuture(SHARE_ORDER_COMMENTS,
                OuerHttpDefaultHandler.class,
                SHARE_ORDER_COMMENTS,
                req,
                new TypeToken<List<Comment>>() {}.getType(),
                listener);
    }

    /**
     * 获取晒单评论接口
     */
    public AgnettyFuture shareOrderAddComment(String id, String content, String commentId,
                                            OuerFutureListener listener) {
        AddCommentReq req = new AddCommentReq();
        req.setId(id);
        req.setContent(content);
        req.setCommentId(commentId);

        return execHttpPostFuture(SHARE_ORDER_ADDCOMMENT,
                OuerHttpDefaultHandler.class,
                SHARE_ORDER_ADDCOMMENT,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 晒单点赞接口
     */
    public AgnettyFuture shareOrderLike(String id, boolean checked,
                                              OuerFutureListener listener) {
        ShareOrderLikeReq req = new ShareOrderLikeReq();
        req.setId(id);
        req.setCheck(checked);

        return execHttpPostFuture(SHARE_ORDER_LIKE,
                OuerHttpDefaultHandler.class,
                SHARE_ORDER_LIKE,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }


    /**
     * 获取品牌详情接口
     */
    public AgnettyFuture brandDetail(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(BRAND_DETAIL,
                OuerHttpDefaultHandler.class,
                BRAND_DETAIL,
                req,
                new TypeToken<Brand>() {}.getType(),
                listener);
    }


    /**
     * 获取用户晒单接口
     */
    public AgnettyFuture userShareOrder(String maxId, String minId, int size, String uid,
                                            OuerFutureListener listener) {
        Page2Req req = new Page2Req();
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);
        req.setUid(uid);
        req.setVersion(OuerApplication.mAppInfo.getVersionName());

        return execHttpPostFuture(USER_SHARE_ORDER,
                OuerHttpDefaultHandler.class,
                USER_SHARE_ORDER,
                req,
                new TypeToken<List<Follow>>() {}.getType(),
                listener);
    }

    /**
     * 获取用户话题接口
     */
    public AgnettyFuture userTopic(String maxId, String minId, int size, String uid,
                                        OuerFutureListener listener) {
        Page2Req req = new Page2Req();
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);
        req.setUid(uid);

        return execHttpPostFuture(USER_TOPIC,
                OuerHttpDefaultHandler.class,
                USER_TOPIC,
                req,
                new TypeToken<List<Topic>>() {}.getType(),
                listener);
    }

    /**
     * 获取用户话题接口
     */
    public AgnettyFuture userVideo(int page, int size, String uid,
                                   OuerFutureListener listener) {
        PageReq req = new PageReq();
        req.setPage(page);
        req.setSize(size);

        return execHttpPostFuture(USER_VIDEO,
                OuerHttpDefaultHandler.class,
                USER_VIDEO,
                req,
                new TypeToken<List<Follow>>() {}.getType(),
                listener);
    }


    /**
     * 晒单详情接口
     */
    public AgnettyFuture shareOrderDetail(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(SHARE_ORDER_DETAIL,
                OuerHttpDefaultHandler.class,
                SHARE_ORDER_DETAIL,
                req,
                new TypeToken<Follow>() {}.getType(),
                listener);
    }


    /**
     * 用户信息修改接口
     */
    public AgnettyFuture userModify(UserModifyReq req, OuerFutureListener listener) {
        return execHttpPostFuture(MODIFY_USER,
                UserModifyHandler.class,
                MODIFY_USER,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }


    /**
     * 上传头像
     *
     * @param imgs
     * @param belong
     * @param listener
     * @return
     */
    public AgnettyFuture uploadImages(List<String> imgs, EFileBelong belong,
                                      OuerFutureListener listener) {
        UploadImagesReq req = new UploadImagesReq();
        req.setBelong(belong.toString());

        FormUploadFile[] files = null;

        if (UtilList.isNotEmpty(imgs)) {
            files = new FormUploadFile[imgs.size()];
            for (int i = 0; i < 1; i++) {
                String path = imgs.get(i).replaceFirst(CstScheme.FILE, "");
                FormUploadFile file = new FormUploadFile("file["+i+"]",
                        "images", path);
                file.setContentType("image/*");
                files[i] = file;
            }
        }

        return execFormUploadFuture(UPLOAD_IMAGES,
                OuerFormUploadDefaultHandler.class,
                UPLOAD_IMAGES,
                req,
                new TypeToken<List<Image>>() {
                }.getType(),
                listener, files);
    }


    /**
     * 发布晒单接口
     */
    public AgnettyFuture shareOrderAdd(ShareOrderAddReq req, OuerFutureListener listener) {
        return execHttpPostFuture(SHARE_ORDER_ADD,
                ShareOrderAddHandler.class,
                SHARE_ORDER_ADD,
                req,
                new TypeToken<Follow>() {}.getType(),
                listener);
    }

    /**
     * 搜索标签接口
     */
    public AgnettyFuture searchTag(String key, int page, int size, OuerFutureListener listener) {
        TagSearchReq req = new TagSearchReq();
        req.setPage(page);
        req.setSize(size);
        req.setKey(key);

        return execHttpPostFuture(SHARE_ORDER_TAG_SEARCH,
                OuerHttpDefaultHandler.class,
                SHARE_ORDER_TAG_SEARCH,
                req,
                new TypeToken<List<Tag>>() {}.getType(),
                listener);
    }


    /**
     * 话题关注
     * @param id
     * @param listener
     * @return
     */
    public AgnettyFuture topicFollow(String id, boolean check, OuerFutureListener listener) {
        AddWishReq req = new AddWishReq();
        req.setId(id);
        req.setCheck(check);

        return execHttpPostFuture(TOPIC_FOLLOW,
                OuerHttpDefaultHandler.class,
                TOPIC_FOLLOW,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }


    /**
     * 搜索标签接口
     */
    public AgnettyFuture isInvition(String uid, String machineCode, OuerFutureListener listener) {
        InvitationReq req = new InvitationReq();
        req.setUid(uid);
        req.setMachineCode(machineCode);

        return execHttpPostFuture(IS_INVITATION,
                OuerHttpDefaultHandler.class,
                IS_INVITATION,
                req,
                new TypeToken<Invitation>() {}.getType(),
                listener);
    }


    /**
     * 获取标签的帖子聚合
     */
    public AgnettyFuture getTagPosts(String id, String maxId, String minId, int size,
                                          OuerFutureListener listener) {
        Page3Req req = new Page3Req();
        req.setId(id);
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);
        req.setVersion(OuerApplication.mAppInfo.getVersionName());

        return execHttpPostFuture(TAG_POSTS,
                OuerHttpDefaultHandler.class,
                TAG_POSTS,
                req,
                new TypeToken<List<Follow>>() {}.getType(),
                listener);
    }


    /**
     * 专题评论点赞
     * @param id
     * @param listener
     * @return
     */
    public AgnettyFuture topicCommentFaver(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(TOPIC_COMMENT_FAVER,
                OuerHttpDefaultHandler.class,
                TOPIC_COMMENT_FAVER,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }


    /**
     * 专题点赞
     * @param id
     * @param listener
     * @return
     */
    public AgnettyFuture topicFaver(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(TOPIC_FAVER,
                OuerHttpDefaultHandler.class,
                TOPIC_FAVER,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }


    /**
     * 专题评论列表
     * @param id
     * @param maxId
     * @param minId
     * @param size
     * @param listener
     * @return
     */
    public AgnettyFuture topicCommentList(String id, String maxId, String minId, int size,
                                     OuerFutureListener listener) {
        Page3Req req = new Page3Req();
        req.setId(id);
        req.setMaxId(maxId);
        req.setMinId(minId);
        req.setSize(size);

        return execHttpPostFuture(TOPIC_COMMENT_LIST,
                OuerHttpDefaultHandler.class,
                TOPIC_COMMENT_LIST,
                req,
                new TypeToken<List<Comment>>() {}.getType(),
                listener);
    }

    /**
     * 专题评论接口
     */
    public AgnettyFuture topicAddComment(String id, String content, String commentId,
                                              OuerFutureListener listener) {
        AddCommentReq req = new AddCommentReq();
        req.setId(id);
        req.setContent(content);
        req.setCommentId(commentId);

        return execHttpPostFuture(TOPIC_ADDCOMMENT,
                OuerHttpDefaultHandler.class,
                TOPIC_ADDCOMMENT,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }


    /**
     * 今日推荐接口
     */
    public AgnettyFuture goodsRecommend(OuerFutureListener listener) {

        return execHttpPostFuture(GOODS_RECOMMEND,
                OuerHttpDefaultHandler.class,
                GOODS_RECOMMEND,
                null,
                new TypeToken<Product>() {}.getType(),
                listener);
    }


    /**
     * 首页Banner列表
     */
    public AgnettyFuture homeBanner(OuerFutureListener listener) {
        return execHttpPostFuture(HOME_BANNER_LIST,
                OuerHttpDefaultHandler.class,
                HOME_BANNER_LIST,
                null,
                new TypeToken<List<Banner>>() {}.getType(),
                listener);
    }


    /**
     * 首页商品专题
     */
    public AgnettyFuture goodsTopic(OuerFutureListener listener) {
        return execHttpPostFuture(HOME_GOODS_TOPIC_LIST,
                OuerHttpDefaultHandler.class,
                HOME_GOODS_TOPIC_LIST,
                null,
                new TypeToken<List<GoodTopic>>() {}.getType(),
                listener);

    }

    public AgnettyFuture newhotGoodsTopic(OuerFutureListener listener) {
        return execHttpPostFuture(HOME_NEWHOT_GOODS_TOPIC,
                OuerHttpDefaultHandler.class,
                HOME_NEWHOT_GOODS_TOPIC,
                null,
                new TypeToken<GoodTopic>() {}.getType(),
                listener);

    }

    /**
     * 热门帖子
     */
    public AgnettyFuture hotPost(OuerFutureListener listener) {
        return execHttpPostFuture(HOME_HOT_POST_LIST,
                OuerHttpDefaultHandler.class,
                HOME_HOT_POST_LIST,
                null,
                new TypeToken<List<Follow>>() {}.getType(),
                listener);
    }


    /**
     * 热门帖子
     */
    public AgnettyFuture newhotPost(OuerFutureListener listener) {
        return execHttpPostFuture(NEW_HOT_POST_LIST,
                OuerHttpDefaultHandler.class,
                NEW_HOT_POST_LIST,
                null,
                new TypeToken<List<Follow>>() {}.getType(),
                listener);
    }

    /**
     * 置顶视频列表(视频帖子)
     */
    public AgnettyFuture topVideo(OuerFutureListener listener) {
        return execHttpPostFuture(TOP_VIDEO_LIST,
                OuerHttpDefaultHandler.class,
                TOP_VIDEO_LIST,
                null,
                new TypeToken<List<Follow>>() {}.getType(),
                listener);

    }

    /**
     * 所有视频列表(视频帖子)
     */
    public AgnettyFuture homeVideo(int page, int size, OuerFutureListener listener) {
        PageReq req = new PageReq();
        req.setPage(page);
        req.setSize(size);

        return execHttpPostFuture(HOME_VIDEO_LIST,
                OuerHttpDefaultHandler.class,
                HOME_VIDEO_LIST,
                req,
                new TypeToken<List<Follow>>() {}.getType(),
                listener);
    }


    /**
     * 商品专题列表
     */
    public AgnettyFuture goodsTopicList(int page, int size, OuerFutureListener listener) {
        PageReq req = new PageReq();
        req.setPage(page);
        req.setSize(size);

        return execHttpPostFuture(GOODS_TOPIC_LIST,
                OuerHttpDefaultHandler.class,
                GOODS_TOPIC_LIST,
                req,
                new TypeToken<List<GoodTopic>>() {}.getType(),
                listener);
    }


    /**
     * 用户是否已签到
     */
    public AgnettyFuture userIsSign(String uid, OuerFutureListener listener) {
        UidReq req = new UidReq();
        req.setUid(uid);

        return execHttpPostFuture(USER_ISSIGN,
                OuerHttpDefaultHandler.class,
                USER_ISSIGN,
                req,
                new TypeToken<SignResult>() {}.getType(),
                listener);
    }

    /**
     * 用户签到
     */
    public AgnettyFuture userSign(String uid, OuerFutureListener listener) {
        UidReq req = new UidReq();
        req.setUid(uid);

        return execHttpPostFuture(USER_SIGN,
                OuerHttpDefaultHandler.class,
                USER_SIGN,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 用户签到列表
     */
    public AgnettyFuture userSignList(OuerFutureListener listener) {
        return execHttpPostFuture(USER_SIGN_LIST,
                OuerHttpDefaultHandler.class,
                USER_SIGN_LIST,
                null,
                new TypeToken<List<SignTime>>() {}.getType(),
                listener);
    }

    /**
     * 帖子阅读
     */
    public AgnettyFuture postRead(String id, int type, OuerFutureListener listener) {
        PostReadReq req = new PostReadReq();
        req.setId(id);
        req.setType(type);

        return execHttpPostFuture(POST_READ,
                OuerHttpDefaultHandler.class,
                POST_READ,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 视频收藏
     */
    public AgnettyFuture videoFollow(String id, boolean check, OuerFutureListener listener) {
        AddWishReq req = new AddWishReq();
        req.setId(id);
        req.setCheck(check);

        return execHttpPostFuture(VIDEO_FOLLOW,
                OuerHttpDefaultHandler.class,
                VIDEO_FOLLOW,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 视频播放
     */
    public AgnettyFuture videoPlay(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(VIDEO_PLAY,
                OuerHttpDefaultHandler.class,
                VIDEO_PLAY,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 专题对应商品
     */
    public AgnettyFuture topicRelativeGoods(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(TOPIC_RELATIVE_GOODS,
                OuerHttpDefaultHandler.class,
                TOPIC_RELATIVE_GOODS,
                req,
                new TypeToken<List<Product>>() {}.getType(),
                listener);
    }


    /**
     * 置顶的专题
     */
    public AgnettyFuture topTopicList(OuerFutureListener listener) {

        return execHttpPostFuture(TOP_TOPIC_LIST,
                OuerHttpDefaultHandler.class,
                TOP_TOPIC_LIST,
                null,
                new TypeToken<List<Topic>>() {}.getType(),
                listener);
    }

    /**
    * 商品专题详情
    */
    public AgnettyFuture goodsTopicDetial(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(GOODS_TOPIC_DETAIL,
                OuerHttpDefaultHandler.class,
                GOODS_TOPIC_DETAIL,
                req,
                new TypeToken<GoodTopic>() {}.getType(),
                listener);
    }


    /**
     * 商品专题详情
     */
    public AgnettyFuture phoneValidate(OuerFutureListener listener) {
        return execHttpPostFuture(PHONE_VALIDATE,
                OuerHttpDefaultHandler.class,
                PHONE_VALIDATE,
                null,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }


    /**
     * 专题详情
     */
    public AgnettyFuture topicDetail(String id, OuerFutureListener listener) {
        IdReq req = new IdReq();
        req.setId(id);

        return execHttpPostFuture(TOPIC_DETAIL,
                OuerHttpDefaultHandler.class,
                TOPIC_DETAIL,
                req,
                new TypeToken<Topic>() {}.getType(),
                listener);
    }


    /**
     * 图片标签列表
     */
    public AgnettyFuture imageTags(int type, int page, int size, String key, OuerFutureListener listener) {
        ImageTagReq req = new ImageTagReq();
        req.setType(type);
        req.setPage(page);
        req.setSize(size);
        req.setKey(key);

        return execHttpPostFuture(IMAGE_TAGS,
                OuerHttpDefaultHandler.class,
                IMAGE_TAGS,
                req,
                new TypeToken<List<Tag>>() {}.getType(),
                listener);
    }


    /**
     * 心愿单列表
     */
    public AgnettyFuture wishList(int page, int size, OuerFutureListener listener) {
        PageReq req = new PageReq();
        req.setPage(page);
        req.setSize(size);

        return execHttpPostFuture(WISH_LIST,
                WishListHandler.class,
                WISH_LIST,
                req,
                new TypeToken<List<WishProduct>>() {}.getType(),
                listener);
    }


    /**
     * 心愿单列表
     */
    public AgnettyFuture hotSales(int page, int size, OuerFutureListener listener) {
        PageReq req = new PageReq();
        req.setPage(page);
        req.setSize(size);

        return execHttpPostFuture(HOT_SALES,
                OuerHttpDefaultHandler.class,
                HOT_SALES,
                req,
                new TypeToken<List<WishProduct>>() {}.getType(),
                listener);
    }

    /**
     * 心愿单列表
     */
    public AgnettyFuture addWish(String id, boolean check,  OuerFutureListener listener) {
        AddWishReq req = new AddWishReq();
        req.setId(id);
        req.setCheck(check);
        return execHttpPostFuture(ADD_WISH,
                OuerHttpDefaultHandler.class,
                ADD_WISH,
                req,
                new TypeToken<Boolean>() {}.getType(),
                listener);
    }

    /**
     * 商品分仓列表
     */
    public AgnettyFuture productCompartment(String id, int page, int size, OuerFutureListener listener) {
        CompartmentReq req = new CompartmentReq();
        req.setId(id);
        req.setPage(page);
        req.setSize(size);

        return execHttpPostFuture(PRODUCT_COMPARTMENT_LIST,
                OuerHttpDefaultHandler.class,
                PRODUCT_COMPARTMENT_LIST,
                req,
                new TypeToken<List<Product>>() {}.getType(),
                listener);
    }

    /**
     * 商品分仓列表
     */
    public AgnettyFuture cartProductNum( OuerFutureListener listener) {
        return execHttpPostFuture(CART_PRODUCT_NUM,
                CartProductNumHandler.class,
                CART_PRODUCT_NUM,
                null,
                new TypeToken<Integer>() {}.getType(),
                listener);
    }


    /**
     * 购物车列表
     */
    public AgnettyFuture newCartList( OuerFutureListener listener) {
        return execHttpPostFuture(NEW_CART_LIST,
                OuerHttpDefaultHandler.class,
                NEW_CART_LIST,
                null,
                new TypeToken<List<Store>>() {}.getType(),
                listener);
    }

    /**
     * 购物车列表
     */
    public AgnettyFuture cartBalance(List<Product> products,  OuerFutureListener listener) {
        BalanceReq req = new BalanceReq();
        req.setIds(products);

        return execHttpPostFuture(CART_BALANCE,
                OuerHttpDefaultHandler.class,
                CART_BALANCE,
                req,
                new TypeToken<NewOrder>() {}.getType(),
                listener);
    }
}
